<?php namespace Admin\Controller; 

use Hdphp\Controller\Controller;

use Admin\Model\Admin;

class LoginController extends Controller{

	protected $db;
	//构造函数
	public function __init()
	{
		$this->db = new Admin;
	}
	
    //动作
    public function login(){
    	
    	if(IS_POST){
    		if($this->db->login()){
    			View::success('登陆成功','Index/index');
    		}else{
    			View::error($this->db->getError());
    		}
    	}else{
    		View::make();
    	}
    }
	
	//登陆验证码
	public function code()
	{
		Code::make();
	}
	
	//退出登陆
	public function quit()
	{
		session_unset();
		session_destroy();
		go('login');	
	}
	
	
	
	
}
